<template>
  <div class="main" :key="CSLegend">
    <el-tabs>
      <div class="chartsStyle">
        <div class="chart-title">

          <tr style="height: 30px;">
            <td><span class="nature">点颜色</span></td>
            <td>
              <el-color-picker v-model="pointColor" show-alpha size="mini"></el-color-picker>
            </td>
          </tr>
          <br/>

         <!-- <tr>
            <td><span class="nature">点形状</span></td>
            <td>
              <el-select v-model="pointType" clearable placeholder="请选择" size="mini" style="width: 170px;margin-left: 9px " >
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </td>
          </tr>
          <br/>-->

          <tr style="height: 30px;">
            <td><span class="nature">背景颜色</span></td>
            <td>
              <el-color-picker v-model="backgroundColor" show-alpha size="mini"></el-color-picker>
            </td>
          </tr>
          <br/>

          <tr style="height: 30px;">
            <td><span class="nature">映射线颜色</span></td>
            <td>
              <el-color-picker v-model="shadowColor" show-alpha size="mini"></el-color-picker>
            </td>
          </tr>
          <br/>

          <tr>
            <td><span class="nature">刻度标签颜色</span></td>
            <td>
              <el-color-picker v-model="labColor" show-alpha size="mini"></el-color-picker>
            </td>
          </tr>
          <br/>

          <tr>
            <td><span class="nature">点大小</span></td>
            <td>
              <el-input-number v-model="pointSize" @change="setPointSize" :min="1" :max="30"  size="small" >
              </el-input-number>
            </td>
          </tr>
          <br/>

          <tr>
            <td><span class="nature">刻度表前大小</span></td>
            <td>
              <el-input-number v-model="labSize" @change="setLabSize" :min="10" :max="20"  size="small" >
              </el-input-number>
            </td>
          </tr>
        </div>
      </div>
    </el-tabs>
  </div>
</template>

<script>

export default {
  data () {
    return {
      backgroundColor: '',
      pointColor: '',
      pointSize: 10,
      pointType: 'circle',
      labColor: '', // 刻度标签颜色
      labSize: '10', // 刻度标签大小
      shadowColor: '#e64d41', // 映射线颜色
      options: [{
        value: 'circle',
        label: '圆形'
      }, {
        value: 'rect',
        label: '正方形'
      }, {
        value: 'triangle',
        label: '三角形'
      }, {
        value: 'diamond',
        label: '菱形'
      }]
    }
  },
  methods: {
    setPointSize (val) {
      this.$store.state.cubeScatterLegend.pointSize = val
    },
    setLabSize (val) {
      this.$store.state.cubeScatterLegend.labSize = val
    }
  },

  watch: {
    pointType (val) {
      console.log('设置点类型为')
      console.log(val)
      this.$store.state.cubeScatterLegend.pointType = val
    },
    backgroundColor (val) {
      console.log('背景颜色设置为')
      this.$store.state.cubeScatterLegend.backgroundColor = val
      console.log(this.$store.state.cubeScatterLegend.backgroundColor)
    },
    pointColor (val) {
      this.$store.state.cubeScatterLegend.pointColor = val
    },
    pointSize (val) {
      this.$store.state.cubeScatterLegend.pointSize = val
    },
    labColor (val) {
      this.$store.state.cubeScatterLegend.labColor = val
    },
    labSize (val) {
      this.$store.state.cubeScatterLegend.labSize = val
    },
    shadowColor (val) {
      this.$store.state.cubeScatterLegend.shadowColor = val
    }

  }
}
</script>

<style lang="scss" scoped>
  .main{
    background-color: #E6E3E3;
  }
  .nature{
    font-size: 17px;
    font-weight:bold;

  }

</style>
